package com.wyl.selenium.controller;

import com.wyl.selenium.common.CommonPage;
import com.wyl.selenium.common.ResponseData;
import com.wyl.selenium.req.ProjectInterfaceReq;
import com.wyl.selenium.service.ProjectInterfaceService;
import com.wyl.selenium.vo.LabelNodeVo;
import com.wyl.selenium.vo.ProjectInterfaceVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * @Description
 * @Author WuYiLong
 * @Date 2023/11/8 17:01
 */
@Api(tags = "项目接口api")
@RestController
@RequestMapping(value = "projectInterface")
public class ProjectInterfaceController {

    @Autowired
    private ProjectInterfaceService projectInterfaceService;

    @ApiOperation(value = "导入项目接口")
    @PostMapping(value = "importProjectInterface")
    public ResponseData importProjectInterface(@RequestPart MultipartFile file,Long projectBaseInfoId) throws IOException {
        projectInterfaceService.importProjectInterface(file,projectBaseInfoId);
        return ResponseData.success();
    }

    @ApiOperation(value = "分页")
    @PostMapping(value = "pageProjectInterface")
    public ResponseData<CommonPage<List<ProjectInterfaceVo>>> pageProjectInterface(@RequestBody ProjectInterfaceReq req) {
        return ResponseData.successInstance(projectInterfaceService.pageProjectInterface(req));
    }



}
